﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SetRoles.aspx.cs" Inherits="BuXiaChu.OrderDishes.Web.Admin.Sys.SetRoles" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register TagPrefix="Menu" TagName="Header" Src="~/Modules/Menu/Header.ascx" %>
<%@ Register TagPrefix="Menu" TagName="Footer" Src="~/Modules/Menu/Footer.ascx" %>
<%@ Register TagPrefix="Menu" TagName="SystemLeft" Src="~/Modules/Menu/SystemLeft.ascx" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link media="screen, projection" rel="stylesheet" type="text/css" href="/css/Blueprint/screen.css" />
    <link media="screen, projection" rel="stylesheet" type="text/css" href="/css/main.css" />

    <script type="text/javascript" src="../js/Extend.js"></script>

    <script type="text/javascript" src="../js/Common.js"></script>

    <script type="text/javascript" src="../js/jquery-vsdoc.js"></script>

</head>
<body>
    <div class="container">
        <Menu:Header ID="Header1" runat="server" />
        <Menu:SystemLeft ID="menu_SystemLeft" runat="server" />
        <div class="span-20 last">
            <form id="form1" runat="server">
            <div class="boxc">
                <input type="hidden" runat="server" id="txt_RoleId" />
                <div>
                    <a href="Index.aspx">返回</a></div>
                <span>登录名：<%= HttpUtility.HtmlEncode(sysUserInfo.LoginName)%></span>
                <br />
                <span>权限列表：</span>
                <% if (roleList != null)
                   { %>
                <% 
                    var index = 0;
                    foreach (var item in roleList)
                    {
                        if (index % 2 == 0)
                        {
                            Response.Write("<br/>");
                        }
                        index++;                            
                %>
                <input type="radio" name="roles" id="rad_<%=index%>"
                    value="<%=item.RoleId %>" /><label for="rad_<%=index %>"><%=HttpUtility.HtmlEncode(item.Name)%></label>
                <%} %>
                <br />
                <input type="button" value="保存" id="btn_Save" />
                <%}
                   else
                   {%>
                <span>无权限</span>
                <%} %>
            </div>
            </form>
        </div>
        <Menu:Footer ID="Footer1" runat="server" />
    </div>
</body>
</html>

<script type="text/javascript">
    $(jDoc("btn_Save")).click(function() {
        var id = jDoc.getElementsBy(null, "input"
        , function(e) {
            if (e.type === "radio" && e.checked) {
                return true;
            }
        })
        if (id.length == 0) {
            alert("请选择权限");
        } else {
            jDoc("txt_RoleId").value = id[0].value;
            jDoc("form1").submit();
        }
    });
</script>

<script type="text/javascript">
(function(){
    var roleId=jDoc("txt_RoleId").value;
    jDoc.getElementsBy(null, "input"
        , function(e) {
            if (e.type === "radio" && e.value==roleId) {
                e.checked=true;
            }
        })
    switch(<%=saveStatus %>){
        case 1:alert("操作成功");break;
        case 0:alert("操作失败");break;
        default:break;
    }
})();
</script>

